﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Nirvana
{
    /// <summary>
    /// 定时间加载对象携程：时间一到就返回
    /// </summary>
    public sealed class WaitLoadObjectTimer : WaitLoadObject
    {
        private Object obj;
        private float time;
        public WaitLoadObjectTimer(Object obj,float t)
        {
            this.obj = obj;
            time = t;
        }

        public WaitLoadObjectTimer(string format,params object[] args)
        {
            base.Error = string.Format(format, args);
        }

        public override bool keepWaiting
        {
            get
            {
                this.time -= Time.unscaledDeltaTime;
                return this.time > 0;
            }
        }

        public override Object GetObject()
        {
            return obj;
        }

        public override bool Load()
        {
            return false;
        }

    }
}

